#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

bool isShorter(const string &str1,const string &str2)
{
	return str1.size() < str2.size();
}

bool GT4(const string &str)
{
	return str.size() < 4;
}

string make_plural(const int &count,const string &word,const string &ending)
{
	return (count==1) ? word : word+ending;
}

int main()
{
	vector<string> words;
	cout<<"enter some string:"<<endl;
	string next_word;
	while(cin>>next_word)
	{
		words.push_back(next_word);
	}

	sort(words.begin(),words.end());

	vector<string>::iterator end_unique = unique(words.begin(),words.end());
	words.erase(end_unique,words.end());
	stable_sort(words.begin(),words.end(),isShorter);
	vector<string>::size_type wc=count_if(words.begin(),words.end(),GT4);
	cout<<wc<<" "<<make_plural(wc,"word","s")<<" 4 characters or longer"<<endl;
	return 0;
}